using System;
using System.Collections.Generic;
using System.Text;

using System.Web.UI;
using System.Collections;
using System.ComponentModel;
using System.Web.UI.WebControls;

namespace Framework
{
	public class Combos : System.Web.UI.WebControls.DropDownList
	{
		#region [ Combo de Enumerador ]
		
        public static void CarregarComboEnum(DropDownList Combo, Type EnumType)
		{
			string[] EnumItens = Enum.GetNames(EnumType);

			Combo.Items.Insert(0, new ListItem("", ""));

			foreach (string EnumItem in EnumItens)
				Combo.Items.Add(new ListItem(EnumItem.Replace("_"," "), EnumItem));
		}

        #endregion

        #region [ Carrega o valor do Combo ]

        public static Enum CarregarValorCombo(DropDownList Combo, Type EnumType)
		{
			return (Enum)Enum.Parse(EnumType, Combo.SelectedValue, true);
		}

		#endregion
	}
}